home *** CD-ROM | disk | FTP | other *** search
-
- /*
- $Id: mt_init.c,v 1.2 1999/08/30 19:28:03 carlos Exp $.
- */
-
- #include "mt_includes.h"
-
-
- ULONG __saveds __stdargs L_OpenLibs(struct MuiToolkitBase *MuiToolkitBase);
- void __saveds __stdargs L_CloseLibs(void);
-
- struct ExecBase *SysBase = NULL;
- struct IntuitionBase *IntuitionBase = NULL;
- struct GfxBase *GfxBase = NULL;
- struct Library *UtilityBase = NULL;
- struct DosLibrary *DOSBase = NULL;
- struct Library *MUIMasterBase = NULL;
-
- #define VERSION 1
- #define REVISION 0
-
- #define EXLIBNAME "muitoolkit"
- #define EXLIBVER " 1.00 (27.09.99)"
-
- char __aligned ExLibName [] = EXLIBNAME ".library";
- char __aligned ExLibID [] = EXLIBNAME EXLIBVER;
- char __aligned Copyright [] = "© Copyright 1999 Marcin Orlowski <carlos@amiga.com.pl> All rights reserved";
-
- char __aligned VERSTRING [] = "\0$VER: " EXLIBNAME EXLIBVER;
-
- /*************************************************************
- *************************************************************/
-
- extern ULONG InitTab[];
- extern APTR EndResident; /* below */
-
- struct Resident __aligned ROMTag = /* do not change */
- {
- RTC_MATCHWORD,
- &ROMTag,
- &EndResident,
- RTF_AUTOINIT,
- VERSION,
- NT_LIBRARY,
- 0,
- &ExLibName[0],
- &ExLibID[0],
- &InitTab[0]
- };
-
- APTR EndResident;
-
- struct MyDataInit /* do not change */
- {
- UWORD ln_Type_Init; UWORD ln_Type_Offset; UWORD ln_Type_Content;
- UBYTE ln_Name_Init; UBYTE ln_Name_Offset; ULONG ln_Name_Content;
- UWORD lib_Flags_Init; UWORD lib_Flags_Offset; UWORD lib_Flags_Content;
- UWORD lib_Version_Init; UWORD lib_Version_Offset; UWORD lib_Version_Content;
- UWORD lib_Revision_Init; UWORD lib_Revision_Offset; UWORD lib_Revision_Content;
- UBYTE lib_IdString_Init; UBYTE lib_IdString_Offset; ULONG lib_IdString_Content;
- ULONG ENDMARK;
- } DataTab =
- {
- INITBYTE(OFFSET(Node, ln_Type), NT_LIBRARY),
- 0x80, (UBYTE) OFFSET(Node, ln_Name), (ULONG) &ExLibName[0],
- INITBYTE(OFFSET(Library, lib_Flags), LIBF_SUMUSED|LIBF_CHANGED),
- INITWORD(OFFSET(Library, lib_Version), VERSION),
- INITWORD(OFFSET(Library, lib_Revision), REVISION),
- 0x80, (UBYTE) OFFSET(Library, lib_IdString), (ULONG) &ExLibID[0],
- (ULONG) 0
- };
-
-
- /*************************************************************
- *************************************************************/
-
- ULONG __saveds __stdargs L_OpenLibs(struct MuiToolkitBase *MuiToolkitBase)
- {
- SysBase = (*((struct ExecBase **) 4));
-
- if( ! ( IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37) ) )
- return(FALSE);
-
- if( ! ( UtilityBase = OpenLibrary("utility.library", 37) ) )
- return(FALSE);
-
- if( ! ( DOSBase = (struct DosLibrary *) OpenLibrary( "dos.library", 37) ) )
- return(FALSE);
-
- if( ! (GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 37) ) )
- return( FALSE );
-
- if( ! (MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN) ) )
- return( FALSE );
-
-
- MuiToolkitBase->mt_IntuitionBase = IntuitionBase;
- MuiToolkitBase->mt_DOSBase = DOSBase;
- MuiToolkitBase->mt_GfxBase = GfxBase;
- MuiToolkitBase->mt_SysBase = SysBase;
- MuiToolkitBase->mt_UtilityBase = (struct UtilityBase *)UtilityBase;
- MuiToolkitBase->mt_MUIMasterBase = MUIMasterBase;
-
-
- return(TRUE);
- }
-
- /*************************************************************
- *************************************************************/
-
- void __saveds __stdargs L_CloseLibs(void)
- {
- if(DOSBase) CloseLibrary((struct Library *) DOSBase );
- if(GfxBase) CloseLibrary((struct Library *) GfxBase );
- if(IntuitionBase) CloseLibrary((struct Library *) IntuitionBase );
- if(UtilityBase) CloseLibrary((struct Library *) UtilityBase );
-
- if(MUIMasterBase) CloseLibrary((struct Library *) MUIMasterBase );
- }
-